package cn.edu.scau.cmi.wangmaoren.client.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import cn.edu.scau.cmi.wangmaoren.spring.domain.Student;


//本例子使用Spring，学生、教师对象都预先封装好，直接获取使用
public class Spring02ApplicationContextClient
{

	public Spring02ApplicationContextClient()
	{
	}

	public static void main(String[] args)
	{
		ApplicationContext applicationContext = getApplicationContext1();
		Student student = (Student) applicationContext.getBean("zhangsan");
		System.out.println(student.getName() + "的毕业设计指导导师是：" + student.getTutor().getName());

	}

	private static ApplicationContext getApplicationContext1()
	{
		ApplicationContext ac1 = new ClassPathXmlApplicationContext("applicationContext.xml");

		return ac1;
	}

}
